//package com.zmn.plat.dubbo.impl.area;
//
//import com.google.common.collect.Lists;
//import com.zmn.common.constant.GlobalConsts;
//import com.zmn.common.dictionary.DictModel;
//import com.zmn.common.dictionary.GlobalDict;
//import com.zmn.common.dictionary.KvModel;
//import com.zmn.common.dto.AreaDTO;
//import com.zmn.common.dto.VtDTO;
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.common.utils.collection.CollectionUtil;
//import com.zmn.common.utils.number.NumberUtil;
//import com.zmn.gateway.dubbo.client.GUserHolder;
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import com.zmn.mcc.permit.mysql.annotation.ZmnDPermit;
//import com.zmn.mcc.permit.mysql.enums.DPermitTypeEnum;
//import com.zmn.plat.business.interfaces.area.BaseAreaBService;
//import com.zmn.plat.common.dto.PermitDTO;
//import com.zmn.plat.common.dto.area.AreaDRO;
//import com.zmn.plat.common.dto.area.BaseCityDRO;
//import com.zmn.plat.common.dto.area.CitySimpleDRO;
//import com.zmn.plat.common.exception.PlatException;
//import com.zmn.plat.dubbo.interfaces.area.BaseAreaListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.manager.interfaces.cache.AreaCache;
//import com.zmn.plat.model.entity.area.AreaQuery;
//import com.zmn.plat.model.entity.area.BaseArea;
//import com.zmn.plat.services.interfaces.area.BaseAreaService;
//import com.zmn.plat.services.interfaces.company.BaseCompanyAreaService;
//import com.zmn.plat.utils.bean.BeanCopyUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.dubbo.config.annotation.Service;
//import org.jetbrains.annotations.NotNull;
//import org.springframework.beans.BeanUtils;
//import org.springframework.cache.annotation.Cacheable;
//import org.springframework.cglib.beans.BeanCopier;
//import org.springframework.cglib.core.Converter;
//import org.springframework.util.CollectionUtils;
//
//import javax.annotation.Resource;
//import java.util.*;
//import java.util.function.Function;
//import java.util.stream.Collectors;
//
//import static java.util.stream.Collectors.groupingBy;
//
///**
// * @author nowind
// * @since 2018/8/24 17:11
// */
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//@Slf4j
//public class BaseAreaListRemoteServiceImpl implements BaseAreaListRemoteService {
//    private static final String TAG = "区域 dubbo 接口";
//    @Resource
//    private AreaCache areaCache;
//    @Resource
//    private BaseAreaBService baseAreaBService;
//    @Resource
//    private BaseAreaService baseAreaService;
//    @Resource
//    private BaseCompanyAreaService baseCompanyAreaService;
//
//    private final BeanCopier areaBeanCopy = BeanCopier.create(BaseArea.class, AreaDRO.class, true);
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:city:province:city:'+#p0", cacheNames = "redis1h")
//    public ResponseDTO<AreaDRO> getCityAndProvinceByCityId(Integer cityId) {
//        log.info("getCityAndProvinceByCityId入参cityId：{}", cityId);
//        try {
//            BaseArea area = baseAreaService.findCityAndProvinceByCityId(cityId);
//            AreaDRO areaDRO = new AreaDRO();
//            BeanCopyUtils.copyProperties(area, areaDRO);
//            return ResponseDTO.success(areaDRO, GlobalConsts.SUCCESS_MSG);
//        } catch (PlatException ex) {
//            return ResponseDTO.fromErrorCodeTable(ex.getErrorCode());
//        } catch (Exception e) {
//            log.error("getCityAndProvinceByCityId失败", e);
//            return ResponseDTO.fail("系统异常");
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:area:id:'+#p0", cacheNames = "redis5m")
//    public ResponseDTO<AreaDRO> getById(Integer areaId) {
//        log.info("getById参数：areaId:{}", areaId);
//        BaseArea area = areaCache.getArea(areaId);
//        if (area == null) {
//            log.error("{}参数:areaId:{}对应的Area对象不存在", TAG, areaId);
//            return ResponseDTO.fail(String.format("[%s]对应的Area对象不存在", areaId));
//        }
//
//        try {
//            AreaDRO areaDRO = new AreaDRO();
//            BeanCopyUtils.copyProperties(area, areaDRO);
//            return ResponseDTO.success(areaDRO, GlobalConsts.SUCCESS_MSG);
//        } catch (Exception ex) {
//            log.error("{}对象:{}拷贝出错", TAG, "CopyObjectUtil<Area, AreaDRO>", ex);
//            return ResponseDTO.fail("拷贝Area对象出错");
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:area:code:'+#p0", cacheNames = "redis1h")
//    public ResponseDTO<AreaDRO> getByCode(Integer code) {
//
//        if (code == null) {
//            log.error("{}参数:{}不能为空", TAG, "code");
//            return ResponseDTO.fail("areaId 不能为空");
//        }
//
//        BaseArea area = areaCache.getAreaByCode(code);
//        if (area == null) {
//            log.error("{}参数:code:{}对应的Area对象不存在", TAG, code);
//            return ResponseDTO.fail(String.format("[%s]对应的Area对象不存在", code));
//        }
//
//        AreaDRO areaDRO = new AreaDRO();
//
//        try {
//            BeanCopyUtils.copyProperties(area, areaDRO);
//        } catch (Exception ex) {
//            log.error("{}对象:{}拷贝出错", TAG, "CopyObjectUtil<Area, AreaDRO>", ex);
//            return ResponseDTO.fail(String.format("拷贝Area对象出错"));
//        }
//
//        return ResponseDTO.success(areaDRO, GlobalConsts.SUCCESS_MSG);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<AreaDRO> getByLatAndLng(Double longitude, Double latitude) {
//        log.info("BaseAreaListRemoteServiceImpl.longitude：{}, latitude: {}", longitude, latitude);
//
//        BaseArea baseArea = baseAreaService.getAreaByLatLng(longitude, latitude);
//
//        if (baseArea == null) {
//            return ResponseDTO.fail("匹配区域失败");
//        }
//
//        AreaDRO areaDRO = new AreaDRO();
//        try {
//            areaBeanCopy.copy(baseArea, areaDRO, new Converter() {
//                @Override
//                public Object convert(Object value, Class target, Object context) {
//                    // int 和 Integer转换
//                    if (value instanceof Integer) {
//                        return (Integer) value;
//                    }
//                    return value;
//                }
//            });
//        } catch (Exception e) {
//            e.printStackTrace();
//            log.error("{} getAreaByLatLng: 类型转换异常", "[zmn]", e);
//            return ResponseDTO.fail("匹配区域失败，类型转换异常");
//        }
//        return ResponseDTO.success(areaDRO);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<AreaDRO> getAreaByAddress(String address) {
//        log.info("{}, getAreaByAddress入参address：{}", TAG, address);
//        try {
//            return ResponseDTO.success(baseAreaBService.getAreaByAddress(address));
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getAreaByAddress系统异常：", e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listAreaVtByParentId(Integer parentId) {
//        return listAreaVtByParentIdAndStaffId(parentId, GlobalConsts.NONE);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listAreaVtByParentId(List<Integer> parentIdList, Integer level) {
//
//        return listAreaVtByParentIdAndStaffId(parentIdList, GlobalConsts.NONE, level);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listAreaVtByParentId(Integer parentId, Integer level) {
//        return listAreaVtByParentId(parentId, level, false);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listAreaVtByParentId(Integer parentId, Integer level, Boolean limitPermit) {
//        Integer staffId = null;
//        if (limitPermit) {
//            staffId = GUserHolder.getCurrentLoginStaffId();
//            if (NumberUtil.isNullOrZero(staffId)) {
//                staffId = -1;
//            }
//        }
//        return listAreaVtByParentIdAndStaffId(parentId, staffId);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:area:staff:' + #p2 + ':parent:' + #p0", cacheNames = "redis5m")
//    public ResponseDTO<List<VtDTO>> listAreaVtByParentId(Integer parentId, Integer level, Integer staffId) {
//        log.info("入参：parentId：{}，level:{}，staffId：{}", parentId, level, staffId);
//        try {
//            return ResponseDTO.success(baseAreaBService.listAreaVtByParentIdAndStaffIdNoCache(parentId, staffId));
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("系统异常", e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:area:staff:' + #p1 + ':parent:' + #p0", cacheNames = "redis5m")
//    public ResponseDTO<List<VtDTO>> listAreaVtByParentIdAndStaffId(Integer parentId, Integer staffId) {
//        log.info("入参：parentId：{}，staffId：{}", parentId, staffId);
//        try {
//            return ResponseDTO.success(baseAreaBService.listAreaVtByParentIdAndStaffIdNoCache(parentId, staffId));
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("系统异常", e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listAreaVtByParentIdAndStaffId(List<Integer> parentIdList, Integer staffId, Integer level) {
//        log.info("入参：parentId：{}，staffId：{}，level：{}", parentIdList, staffId, level);
//        if (CollectionUtil.isNullOrEmpty(parentIdList) && null == level) {
//            return ResponseDTO.fail("至少有一个父节点ID或城市等级");
//        }
//        try {
//            return ResponseDTO.success(baseAreaBService.listAreaVtByParentIdListAndStaffId(parentIdList, staffId, level));
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("系统异常", e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:realareainfos:pid:'+#p0", cacheNames = "redis5m")
//    public ResponseDTO<List<AreaDRO>> listAreaInfoByParentId(Integer parentId) {
//        return listAreaInfoByParentId(parentId, null);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    // @Cacheable(key = "'dubbo:list:realareainfos:pid:'+#p0+':staff:'+#p1", cacheNames = "redis1h")
//    public ResponseDTO<List<AreaDRO>> listAreaInfoByParentId(Integer parentId, Integer staffId) {
//        if (NumberUtil.isNullOrZero(parentId)) {
//            parentId = GlobalConsts.TOP_ID;
//        }
//        List<AreaDRO> areaDROList = Lists.newArrayList();
//        try {
//            AreaQuery query = new AreaQuery();
//            query.setParentId(parentId);
//            List<BaseArea> items;
//            if (NumberUtil.isPositiveInteger(staffId)) {
//                items = baseAreaService.listByQueryOfPermit(query, staffId);
//            } else {
//                items = baseAreaService.listByQuery(query);
//            }
//
//            BeanCopier copier = BeanCopier.create(BaseArea.class, AreaDRO.class, false);
//            for (BaseArea baseArea : items) {
//                AreaDRO areaDRO = new AreaDRO();
//                copier.copy(baseArea, areaDRO, null);
//                areaDROList.add(areaDRO);
//            }
//
//        } catch (Exception e) {
//
//            return ResponseDTO.fail(e.getMessage());
//        }
//        return ResponseDTO.success(areaDROList, GlobalConsts.SUCCESS_MSG);
//    }
//
//    /**
//     * 描述: 获取所有的市
//     *
//     * @return com.zmn.common.dto.ResponseDTO<com.zmn.common.dto.VtDTO>
//     * @author wangjie
//     * @since 15:39 2019/4/23
//     **/
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:areas:city:all:'", cacheNames = "redis1h")
//    public ResponseDTO<List<VtDTO>> listAllCityVt() {
//        try {
//            List<VtDTO> collect = Optional.ofNullable(baseAreaService.listAllCity()).orElse(Collections.emptyList()).stream().filter(Objects::nonNull)
//                    .map(city -> new VtDTO(city.getKey(), city.getValue())).collect(Collectors.toList());
//            return ResponseDTO.success(collect, GlobalConsts.SUCCESS_MSG);
//        } catch (Exception e) {
//            log.error(GlobalConsts.FAILD_MSG + "e:{},msg:{}", e, e.getMessage());
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//
//    }
//
//    @Override
//    public ResponseDTO<Map<String, List<VtDTO>>> listAllCityMap() {
//
//        AreaQuery query = new AreaQuery();
//        query.setLevel(GlobalConsts.LEVEL_3);
//        List<BaseArea> baseAreaList = baseAreaService.listByQuery(query);
//        Map<String, List<BaseArea>> collect = baseAreaList.stream().collect(groupingBy(BaseArea::getFirstLetter));
//        Map<String, List<VtDTO>> result = new HashMap<>(collect.size());
//        for (String key : collect.keySet()) {
//            List<VtDTO> vtDTOs = collect.get(key)
//                                        .stream()
//                                        .map(m -> new VtDTO(m.getAreaId(), m.getName(), m.getStatus()))
//                                        .collect(Collectors.toList());
//            result.put(key, vtDTOs);
//        }
//        return ResponseDTO.success(result);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:areas:province:city:dro:all:'", cacheNames = "redis5m")
//    public ResponseDTO<List<CitySimpleDRO>> listAllCityProvince() {
//
//        AreaQuery query = new AreaQuery();
//        query.setLevel(GlobalConsts.LEVEL_3);
//        List<BaseArea> baseAreaList = baseAreaService.listByQuery(query);
//        Map<String, List<BaseArea>> collect = baseAreaList.stream().collect(groupingBy(BaseArea::getFirstLetter));
//        AreaQuery provinceQuery = new AreaQuery();
//        provinceQuery.setLevel(GlobalConsts.LEVEL_2);
//
//        Map<Integer, BaseArea> provinceMap = Optional.ofNullable(baseAreaService.listByQuery(provinceQuery))
//                                                     .orElse(Collections.emptyList())
//                                                     .stream()
//                                                     .collect(Collectors.toMap(BaseArea::getAreaId,
//                                                                               Function.identity()));
//
//        List<CitySimpleDRO> result = new ArrayList<>(collect.size());
//        for (String key : collect.keySet()) {
//
//            List<BaseCityDRO> baseCityDROS = collect.get(key)
//                                                    .stream()
//                                                    .map(m -> {
//                                                        BaseArea province = Optional.ofNullable(
//                                                                provinceMap.get(m.getParentId()))
//                                                                                    .orElse(new BaseArea());
//                                                        return new BaseCityDRO(m.getAreaId(), m.getName(), key,
//                                                                               province.getAreaId(),
//                                                                               province.getName()
//                                                        );
//                                                    })
//                                                    .collect(Collectors.toList());
//            result.add(new CitySimpleDRO(key, baseCityDROS));
//        }
//        return ResponseDTO.success(result);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @ZmnDPermit(types = {DPermitTypeEnum.CITY})
//    public ResponseDTO<List<VtDTO>> listAllCityVtByStaffId(Integer staffId) {
//
//        AreaQuery query = new AreaQuery();
//        query.setLevel(GlobalDict.AREA_LEVEL_CITY);
//        if (NumberUtil.isPositiveInteger(staffId)) {
//            query.setOperatorId(staffId);
//        }
//        List<BaseArea> baseAreaList = baseAreaService.listByQuery(query);
//        List<VtDTO> list = baseAreaList.stream()
//                                       .map(baseArea -> new VtDTO(baseArea.getAreaId(), baseArea.getName()))
//                                       .collect(Collectors.toList());
//        return ResponseDTO.success(list);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @ZmnDPermit(types = {DPermitTypeEnum.CITY})
//    public ResponseDTO<List<VtDTO>> listAllCityVtByLimitPermit(Boolean limitPermit) {
//        Integer staffId = null;
//        if (limitPermit) {
//            staffId = GUserHolder.getCurrentLoginStaffId();
//            if (NumberUtil.isNullOrZero(staffId)) {
//                staffId = -1;
//            }
//        }
//        // -1表示要求数据权限但未通过身份校验
//        if (NumberUtil.isNotNullOrZero(staffId) && staffId == -1) {
//            return ResponseDTO.fail("身份校验失败");
//        }
//        return listAllCityVtByStaffId(staffId);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:areas:city:dro:all:'", cacheNames = "redis5m")
//    public ResponseDTO<List<AreaDRO>> listAllCity() {
//        return listAllCityByStaffId(null);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:areas:city:dro:all:pid:'+#p0", cacheNames = "redis5m")
//    @ZmnDPermit(types = {DPermitTypeEnum.CITY})
//    public ResponseDTO<List<AreaDRO>> listAllCityByStaffId(Integer staffId) {
//        AreaQuery query = new AreaQuery();
//        query.setLevel(GlobalDict.AREA_LEVEL_CITY);
//        if (NumberUtil.isPositiveInteger(staffId)) {
//            query.setOperatorId(staffId);
//        }
//
//        // 市的集合
//        List<BaseArea> baseAreaList = baseAreaService.listByQuery(query);
//
//        // 省市id、name的map结构
//        query.setLevel(GlobalDict.AREA_LEVEL_PROVINCE);
//        Map<Integer, String> map = Optional.ofNullable(baseAreaService.listByQuery(query))
//                .orElse(Collections.emptyList())
//                .stream()
//                .collect(Collectors.toMap(BaseArea::getAreaId, BaseArea::getName));
//
//        BeanCopier copier = BeanCopier.create(BaseArea.class, AreaDRO.class, false);
//        List<AreaDRO> items = baseAreaList.stream().map(mm -> {
//            AreaDRO areaDRO = new AreaDRO();
//            copier.copy(mm, areaDRO, null);
//            areaDRO.setParentName(map.get(mm.getParentId()));
//            return areaDRO;
//        }).collect(Collectors.toList());
//        return ResponseDTO.success(items);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:areas:prov:all:'", cacheNames = "redis1h")
//    public ResponseDTO<List<VtDTO>> listAllProvinceVt() {
//        List<BaseArea> baseAreaList = baseAreaService.listByParentId(GlobalConsts.TOP_ID);
//        List<VtDTO> list = baseAreaList.stream().map(baseArea -> new VtDTO(baseArea.getAreaId(), baseArea.getName())).collect(Collectors.toList());
//        return ResponseDTO.success(list);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<KvModel<Integer, String>>> listAllProvinceAndCity() {
//        List<KvModel<Integer, String>> dros = baseAreaService.listAllCityAndPro();
//        return ResponseDTO.success(dros);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:areas:city:pid:'+#p0", cacheNames = "redis1h")
//    public ResponseDTO<List<VtDTO>> listCityVtByProvinceId(Integer provinceId) {
//        List<VtDTO> dtos = null;
//        try {
//            if (provinceId != null) {
//                List<DictModel> items = areaCache.getAreaList(provinceId);
//                List<VtDTO> dtos1 = getVtDTOS(items);
//                return ResponseDTO.success(dtos1, GlobalConsts.SUCCESS_MSG);
//            }
//
//            List<DictModel> items = areaCache.getAllCity();
//            dtos = getVtDTOS(items);
//        } catch (Exception e) {
//
//            return ResponseDTO.fail(e.getMessage());
//        }
//
//        return ResponseDTO.success(dtos, GlobalConsts.SUCCESS_MSG);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listAreaVtByIds(Integer[] ids) {
//        List<BaseArea> areas = baseAreaService.listAreaByIds(ids);
//
//        List<VtDTO> dtos = new ArrayList<>();
//        areas.forEach(area -> {
//            dtos.add(new VtDTO(area.getAreaId(), area.getName()));
//        });
//
//        return ResponseDTO.success(dtos, GlobalConsts.SUCCESS_MSG);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<Double> getDistanceByDistrictIdAndLongitudeAndLatitude(Integer districtId, Double longitude, Double latitude) {
//        log.info("getDistanceByDistrictIdAndLongitudeAndLatitude入参：districtId：{}，longitude：{}，latitude：{}", districtId, longitude, latitude);
//        try {
//            return ResponseDTO.success(baseAreaBService.getDistanceByDistrictIdAndLongitudeAndLatitude(districtId, longitude, latitude));
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("getDistanceByDistrictIdAndLongitudeAndLatitude失败：", e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<AreaDRO>> getAreaInfoByName(String areaName) {
//        AreaQuery query = new AreaQuery();
//        query.setName(areaName);
//        List<BaseArea> baseAreaList = baseAreaService.listByQuery(query);
//        List<AreaDRO> dros = baseAreaList.stream().map(baseArea -> {
//            AreaDRO areaDRO = new AreaDRO();
//            BeanUtils.copyProperties(baseArea, areaDRO);
//            return areaDRO;
//        }).collect(Collectors.toList());
//        return ResponseDTO.success(dros);
//    }
//
//    @Override
//    public ResponseDTO<List<AreaDRO>> listAboveByLevel(Integer level, Integer status) {
//        List<BaseArea> baseAreaList = baseAreaService.listAboveByLevel(level, status);
//        List<AreaDRO> dros = baseAreaList.stream().map(baseArea -> {
//            AreaDRO areaDRO = new AreaDRO();
//            BeanUtils.copyProperties(baseArea, areaDRO);
//            return areaDRO;
//        }).collect(Collectors.toList());
//        return ResponseDTO.success(dros);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<AreaDRO>> listProvinceAndCityByCityNameList(List<String> areaNameList) {
//        if (CollectionUtils.isEmpty(areaNameList) || areaNameList.size() > DubboConsts.MAX_PARAM_LENGTH) {
//            return ResponseDTO.fail("入参集合长度不合法");
//        }
//
//        List<BaseArea> baseAreaList = baseAreaService.listProvinceAndCityByCityNameList(areaNameList);
//
//        if (CollectionUtils.isEmpty(baseAreaList)) {
//            return ResponseDTO.fail("没有查询到对应区域");
//        }
//
//        List<AreaDRO> dros = baseAreaList.stream().map(baseArea -> {
//            AreaDRO areaDRO = new AreaDRO();
//            BeanUtils.copyProperties(baseArea, areaDRO);
//            areaDRO.setParentId(baseArea.getProvinceId());
//            areaDRO.setParentName(baseArea.getProvinceName());
//            return areaDRO;
//        }).collect(Collectors.toList());
//
//        return ResponseDTO.success(dros);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<AreaDRO>> listAreaByIds(Integer[] ids) {
//
//        List<BaseArea> areas = baseAreaService.listAreaByIds(ids);
//        BeanCopier copier = BeanCopier.create(BaseArea.class, AreaDRO.class, false);
//        List<AreaDRO> dros = Optional.ofNullable(areas).orElse(Lists.<BaseArea>newArrayList()).stream().map(area -> {
//            AreaDRO areaDRO = new AreaDRO();
//            copier.copy(area, areaDRO, null);
//            return areaDRO;
//        }).collect(Collectors.toList());
//        return ResponseDTO.success(dros, GlobalConsts.SUCCESS_MSG);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listCountryVtByCityIds(Integer[] cityIds, Integer staffId) {
//        List<VtDTO> dtos = new ArrayList<>();
//
//        List<BaseArea> areas = baseAreaService.listByParentIds(cityIds, staffId);
//        areas.forEach(area -> {
//            dtos.add(new VtDTO(area.getAreaId(), area.getName()));
//        });
//
//        return ResponseDTO.success(dtos);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public PermitDTO<AreaDTO> listAreaByIds(Integer[] ids, Integer staffId) {
//
//        List<AreaDTO> dtos = new ArrayList<>();
//        List<BaseArea> areas = baseAreaService.listAreaByIds(ids);
//
//        for (BaseArea area : areas) {
//            dtos.add(new AreaDTO(area.getAreaId(), area.getName()));
//        }
//
//        return PermitDTO.success(dtos);
//    }
//
//    @NotNull
//    @ReadOnlyConnection
//    private List<VtDTO> getVtDTOS(List<DictModel> items) {
//        List<VtDTO> dtos = new ArrayList<>();
//
//        items.forEach(dictModel -> {
//            dtos.add(new VtDTO(dictModel.getKey(), dictModel.getValue()));
//        });
//        return dtos;
//    }
//
//}
